package com.dhcc.bpm.modules.scf.controller.HomePageController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dhcc.bpm.modules.scf.dto.HomePageDTO.ScfAddressInfoDTO;
import com.dhcc.bpm.modules.scf.service.HomePageService.IScfAddressInfoService;
import com.dhcc.bpm.modules.scf.vo.HomePageVO.ScfAddressInfoVO;
import lombok.AllArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * 控制器
 *
 * @author liuguoting
 * @since 2023-10-07
 */
@RestController
@AllArgsConstructor
public class ScfAddressInfoController extends BladeController {

    private IScfAddressInfoService scfAddressInfoService;

    /**
     * 自定义分页
     */
    @GetMapping("/page")
    public R<IPage<ScfAddressInfoVO>> page(ScfAddressInfoDTO scfAddressInfo, Query query) {
        IPage<ScfAddressInfoVO> pages = scfAddressInfoService.selectScfAddressInfoPage(Condition.getPage(query), scfAddressInfo);
        return R.data(pages);
    }

    /**
     * 新增
     */
    @PostMapping("/save")
    public R<T> save(String excelRowId) throws IOException {
        return R.status(scfAddressInfoService.addAddressInfo(excelRowId));
    }

}
